********0. Working Directory********
cd "****set folder containing this file as working directory****"
*Note: tables A6 and A7 manually combined from outreg output and model diagnostics below (see respective references)
*Note 2: figure A22 manually combined from weakiv graphs produced below (see respective references)
*Note 3: figures 5, A21, and A23 produced by manually entering margins dydx estimates calculated below, in R-script "appendix4b.R"


********1. Main IV analysis: civil violence********
*produces: components of table A6, figures 5, A22, and A23.

****1.1 Data****
drop _all
insheet using "../replication_data/group_grid_year.csv", clear
gen cw_event_g_peaceyears_l12 = cw_event_g_peaceyears_l1^2
gen cw_event_g_peaceyears_l13 = cw_event_g_peaceyears_l1^3
encode region, gen(fregion)
gen sample_use = cond(main_sample_gid == 1 & sample_colonies_all == 1 & gidl_g_largest_g == 0 & irrelevant == 0 & state_control == 0, 1, 0)

****1.2 Macros****
global group_nat_vars included size
global group_gid_vars rel_grp_gid
global gid_vars lgid_abs lgrid_adm_area gid_ruggedness_avg oil_gid ldistance_capital_gid ldistance_border_gid
global nat_vars lgdppc lpop politya fractionalization1 election_year
global cw_years cw_event_g_peaceyears_l1 cw_event_g_peaceyears_l12 cw_event_g_peaceyears_l13 cw_event_any_unit_slag_l1

****1.3 uncorrected****
**a) SO majorities (table A6, model 5)
probit cw_event_g sa_territory_t former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, cluster(cowcode)
estimates store ivg_full_1a
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table A6, model 7)
probit cw_event_g sa_territory_t former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, cluster(cowcode)
estimates store ivg_full_1b
outreg2 [ivg_full_1a ivg_full_1b] using "../tables/tablea6_models5_7.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)

****1.4 instrumented****
**a) SO majorities (table A6, model 6)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store ivg_full_2a
outreg2 [ivg_full_2a] using "../tables/tablea6_model6.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
*diagnostics (for bottom of table A6)
ivreg2 cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years  i.year i.fregion if sample_use == 1  & rel_grp_gid_largest_g == 1, ffirst  robust cluster(cowcode)
mat list e(first)
*weak IV (figure A22, panel a)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, twostep
weakiv, graph(ar) arlevel (95)
graph export ../figures/figurea22a.pdf, replace
**b) SO-minorities (table A6, model 8)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store ivg_full_2b
outreg2 [ivg_full_2b] using "../tables/tablea6_model8.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
*diagnostics (for bottom of table A6)
ivreg2 cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years  i.year i.fregion if sample_use == 1  & rel_grp_gid_largest_g == 0, ffirst  robust cluster(cowcode)
mat list e(first)
*weak IV (figure A22, panel b)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, twostep
weakiv, graph(ar) arlevel (95)
graph export ../figures/figurea22b.pdf, replace


********2. IV robustness checks: civil violence********
*Produces tables X39-X43.
*Note: marginal effects calculated for figure A23, created in R script "appendix4b.R".

****2.1 land-use controls: agri_ih (percentage of grid cell area covered by agriculture) pasture_ih (percentage of grid cell area covered by pasture) grass_ih (percentage of grid cell area covered by grass)****
**a) SO majorities (table X39, model A141)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs agri_ih pasture_ih grass_ih $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store iv21a
outreg2 [iv21a] using "../tables/iv_robustness_checks/tablex39_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table X39, model A142)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs agri_ih pasture_ih grass_ih $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store iv21b
outreg2 [iv21b] using "../tables/iv_robustness_checks/tablex39_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

****2.2 gross cell product control: gcp_ppp****
**a) SO majorities (table X40, model A143)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gcp_ppp $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store iv22a
outreg2 [iv22a] using "../tables/iv_robustness_checks/tablex40_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table X40, model A144)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gcp_ppp $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store iv22b
outreg2 [iv22b] using "../tables/iv_robustness_checks/tablex40_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

****2.3 cell nighlights control: nlights_calib_mean****
**a) SO majorities (table X41, model A145)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs nlights_calib_mean $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store iv23a
outreg2 [iv23a] using "../tables/iv_robustness_checks/tablex41_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table X41, model A146)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs nlights_calib_mean $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store iv23b
outreg2 [iv23b] using "../tables/iv_robustness_checks/tablex41_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

****2.4 agricultural production x included elites: agri_ih x gidl_g_included****
**a) SO majorities (table X42, model A147)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gidl_g_included agri_ih c.gidl_g_included#c.agri_ih $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store iv24a
outreg2 [iv24a] using "../tables/iv_robustness_checks/tablex42_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table X42, model A148)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gidl_g_included agri_ih c.gidl_g_included#c.agri_ih $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store iv24b
outreg2 [iv24b] using "../tables/iv_robustness_checks/tablex42_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

****2.5 (logged) absolute size at independence: lind_gidl_g_size_abs****
**a) SO majorities (table X43, model A149)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lind_gidl_g_size_abs) former_fr c.lind_gidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 1, vce(cl cowcode) first
estimates store iv25a
outreg2 [iv25a] using "../tables/iv_robustness_checks/tablex43_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) SO-minorities (table X43, model A150)
ivprobit cw_event_g (sa_territory_t = c.former_fr#c.lind_gidl_g_size_abs) former_fr lind_gidl_g_size_abs $group_nat_vars $group_gid_vars $gid_vars $nat_vars $cw_years i.year i.fregion if  sample_use == 1 & rel_grp_gid_largest_g == 0, vce(cl cowcode) first
estimates store iv25b
outreg2 [iv25b] using "../tables/iv_robustness_checks/tablex43_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)


********3. Main IV analysis: communal violence********
*produces: components of table A7, figures 5, A22, and A23.

****3.1 Data****
drop _all
insheet using "../replication_data/dyad_grid_year.csv", clear
gen cv_event_peaceyears_l12 = cv_event_peaceyears_l1^2
gen cv_event_peaceyears_l13 = cv_event_peaceyears_l1^3
gen included_excluded0 = 1- included_excluded
encode region, gen(fregion)
gen sample_use = cond(main_sample_gid == 1 & sample_colonies_all == 1 & gidl_g_largest_g == 0, 1, 0)

****3.2 Macros****
global dyad_nat_vars size_mean size_diff included_excluded excluded_excluded
global dyad_gid_vars rel_grp_gid_mean rel_grp_gid_diff reverse_dyad
global gid_vars lgid_abs lgrid_adm_area gid_ruggedness_avg oil_gid ldistance_capital_gid ldistance_border_gid
global nat_vars lgdppc lpop politya fractionalization1 election_year
global cv_years cv_event_peaceyears_l1 cv_event_peaceyears_l12 cv_event_peaceyears_l13 cv_event_any_unit_slag_l1

****3.3 uncorrected****
**a) all SO maj./min. dyads (table A7, model 9)
probit cv_event sa_territory_t former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), cluster(cowcode)
estimates store ivd_full_1a
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table A7, model 11)
probit cv_event sa_territory_t former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, cluster(cowcode)
estimates store ivd_full_1b
outreg2 [ivd_full_1a ivd_full_1b] using "../tables/tablea7_models9_11.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)

****3.4 instrumented****
**a) all SO maj./min. dyads (table A7, model 10)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store ivd_full_2a
outreg2 [ivd_full_2a] using "../tables/tablea7_model10.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
*diagnostics (for bottom of table A7)
ivreg2 cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), ffirst  robust cluster(cowcode)
mat list e(first)
*weak IV (figure A22, panel c)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), twostep
weakiv, graph(ar) arlevel (95)
graph export ../figures/figurea22c.pdf, replace
**b) included/excluded SO maj./min. dyads (table A7, model 12)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store ivd_full_2b
outreg2 [ivd_full_2b] using "../tables/tablea7_model12.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) replace
*margins (for figure 5, created in R script "appendix4b.R")
margins, dydx(sa_territory_t) predict(pr)
*diagnostics (for bottom of table A7)
ivreg2 cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years  i.year i.fregion if sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1 & year != 1995, ffirst  robust cluster(cowcode)
mat list e(first)
*weak IV (figure A22, panel d)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, twostep
weakiv, graph(ar) arlevel (95)
graph export ../figures/figurea22d.pdf, replace


********4. IV robustness checks: communal violence********
*Produces tables X44-X48.
*Note: marginal effects calculated for figure A23, created in R script "appendix4b.R".

****4.1 land-use controls: agri_ih (percentage of grid cell area covered by agriculture) pasture_ih (percentage of grid cell area covered by pasture) grass_ih (percentage of grid cell area covered by grass)****
**a) all SO maj./min. dyads (table X44, model A151)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs agri_ih pasture_ih grass_ih $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store iv41a
outreg2 [iv41a] using "../tables/iv_robustness_checks/tablex44_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table X44, model A152)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs agri_ih pasture_ih grass_ih $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store iv41b
outreg2 [iv41b] using "../tables/iv_robustness_checks/tablex44_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

***4.2 gross cell product control: gcp_ppp
**a) all SO maj./min. dyads (table X45, model A153)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gcp_ppp $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store iv42a
outreg2 [iv42a] using "../tables/iv_robustness_checks/tablex45_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table X45, model A154)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gcp_ppp $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store iv42b
outreg2 [iv42b] using "../tables/iv_robustness_checks/tablex45_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

***4.3 cell nighlights control: nlights_calib_mean
**a) all SO maj./min. dyads (table X46, model A155)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs nlights_calib_mean $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store iv43a
outreg2 [iv43a] using "../tables/iv_robustness_checks/tablex46_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table X46, model A156)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs nlights_calib_mean $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store iv43b
outreg2 [iv43b] using "../tables/iv_robustness_checks/tablex46_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

***4.4 agricultural production x included elites: agri_ih x gidl_g_included***
**a) all SO maj./min. dyads (table X47, model A157)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gidl_g_included agri_ih c.gidl_g_included#c.agri_ih $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store iv44a
outreg2 [iv44a] using "../tables/iv_robustness_checks/tablex47_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table X47, model A158)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lgidl_g_size_abs) former_fr lgidl_g_size_abs gidl_g_included agri_ih c.gidl_g_included#c.agri_ih $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store iv44b
outreg2 [iv44b] using "../tables/iv_robustness_checks/tablex47_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)

****4.5 (logged) absolute size at independence: lind_gidl_g_size_abs****
**a) all SO maj./min. dyads (table X48, model A159)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lind_gidl_g_size_abs) former_fr lind_gidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1), vce(cl cowcode) first
estimates store iv45a
outreg2 [iv45a] using "../tables/iv_robustness_checks/tablex48_part1.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
**b) included/excluded SO maj./min. dyads (table X48, model A160)
ivprobit cv_event (sa_territory_t = c.former_fr#c.lind_gidl_g_size_abs) former_fr lind_gidl_g_size_abs $dyad_nat_vars $dyad_gid_vars $gid_vars $nat_vars $cv_years i.year i.fregion if  sample_use == 1 & (rel_grp_gid_largest_g1 == 1 | rel_grp_gid_largest_g2 == 1) & included_excluded == 1, vce(cl cowcode) first
estimates store iv45b
outreg2 [iv45b] using "../tables/iv_robustness_checks/tablex48_part2.xls",  alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*,†) 
*margins
margins, dydx(sa_territory_t) predict(pr)
